package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingProjectMapper {
    /**
     * 查询护理项目列表
     * @param name
     * @param status
     * @return
     */
    Page<NursingProjectVo> findAll(String name, Integer status);

    /**
     * 添加护理项目
     * @param nursingProject
     */
    void add(NursingProject nursingProject);

    /**
     * 根据id查询护理项目
     * @param id
     * @return
     */
    @Select("select * from nursing_project where id = #{id}")
    NursingProject getById(Long id);

    /**
     * 修改护理项目
     * @param nursingProject
     */
    void update(NursingProject nursingProject);

    /**
     * 状态的启用/禁用
     * @param id
     * @param status
     */
    @Update("update nursing_project set status = #{status} where id = #{id}")
    void updateStatus(Long id, Integer status);

    /**
     * 删除护理项目
     * @param id
     */
    @Delete("delete from nursing_project where id = #{id}")
    void delete(Long id);

    /**
     * 查询所有护理项目
     * @param nursingProject
     * @return
     */
    @Select("select * from nursing_project")
    List<NursingProjectVo> list(NursingProject nursingProject);
}
